#include "socketclient.h"


EnHandleResult SocketClient::OnPrepareConnect(ITcpClient* pSender, CONNID dwConnID, SOCKET socket)
{
    this->clientPrepared();
    return HR_OK;
}

EnHandleResult SocketClient::OnConnect(ITcpClient* pSender, CONNID dwConnID)
{
    this->clientConnected();
    std::string sd("1122443");
    pSender->Send((BYTE*)sd.c_str(), sd.length());
    return HR_OK;
}

EnHandleResult SocketClient::OnReceive(ITcpClient* pSender, CONNID dwConnID, const BYTE* pData, int iLength)
{
    QByteArray ba((const char*)pData, iLength);
    this->recvMsg(ba);
    return HR_OK;
}

EnHandleResult SocketClient::OnClose(ITcpClient* pSender, CONNID dwConnID, EnSocketOperation enOperation, int iErrorCode)
{
    this->clientClosed();
    return HR_OK;
}
